//
//  UserOthersCell.m
//  ChatForHot
//
//  Created by FLY on 2018/10/14.
//  Copyright © 2018年 FLY. All rights reserved.
//

#import "UserOthersCell.h"

@implementation UserOthersCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        [self.contentView addSubview:self.HOTCHATimgView];
        [self.contentView addSubview:self.HOTCHATinfoLb];
        [self.contentView addSubview:self.HOTCHATneedVipTip];
        [self.contentView addSubview:self.HOTCHATcoverView];
        
        [self.HOTCHATimgView mas_updateConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(self.contentView).mas_offset(15);
            make.centerY.equalTo(self.contentView.mas_centerY);
        }];
        
        [self.HOTCHATinfoLb mas_updateConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(self.HOTCHATimgView.mas_right).mas_offset(10);
            make.centerY.equalTo(self.HOTCHATimgView.mas_centerY);
//            make.width.mas_equalTo(150);
            make.right.lessThanOrEqualTo(self.HOTCHATneedVipTip.mas_left).mas_offset(-10);
        }];
        [self.HOTCHATneedVipTip mas_updateConstraints:^(MASConstraintMaker *make) {
           
            make.right.equalTo(self.contentView.mas_right).mas_offset(-15);
            make.centerY.equalTo(self.contentView.mas_centerY);
        }];
        [self.HOTCHATcoverView mas_updateConstraints:^(MASConstraintMaker *make) {
            
            make.left.equalTo(self.HOTCHATimgView.mas_right).mas_offset(10);
            make.centerY.equalTo(self.contentView.mas_centerY);
            
            make.width.mas_equalTo(130);
            make.height.mas_equalTo(15);
            
        }];
        
    }
    
    return self;
}
- (void)HOTCHATgetModel:(UserInfoModel *)model section:(NSInteger)section index:(NSInteger)index{
    
    _model = model;
    NSString *imgStr = @"";
    NSString *infoStr = @"";
    if (model) {
        
        if (section == 3) {
            self.HOTCHATcoverView.hidden = YES;
            self.HOTCHATneedVipTip.hidden = YES;

            if (index == 0) {
                
                imgStr = @"all_personal_type";
                infoStr = [UserInfoModel HOTCHATgetTypeNameWith:[NSString stringWithFormat:@"%@",model.weight]];
            }else if (index == 1){
                
                imgStr = @"all_personal_income";
                infoStr = [[NSString stringWithFormat:@"%@",model.income] length] > 0 ? model.income : NSLocalizedString(@"StrN043", nil);
            }else if (index == 2){
                
                imgStr = @"all_personal_constellation";
                infoStr = [UserInfoModel HOTCHATgetConstellationNameWithID:[NSString stringWithFormat:@"%@",model.constellation]];
                if (infoStr.length == 0) {
                    
                    infoStr = NSLocalizedString(@"StrN043", nil);
                }
            }
        }else if (section == 4){

                self.HOTCHATneedVipTip.hidden = YES;
                self.HOTCHATcoverView.hidden = HOTCHATAPPINFO.isVIP.integerValue;
            
            if (index == 0) {
                //phone
                imgStr = @"all_personal_phone";
                infoStr = [NSString stringWithFormat:@"%@",model.mobile];
                
                self.HOTCHATneedVipTip.hidden = HOTCHATAPPINFO.isVIP.integerValue;
                
            }else if (index == 1){
                //fcebook
                imgStr = @"all_personal_facebook";
                infoStr = [NSString stringWithFormat:@"%@",model.facebook];
                
            }else if (index == 2){
                //whtspp
                imgStr = @"all_personal_whatsapp";
                infoStr = [NSString stringWithFormat:@"%@",model.whatApp];
            }else if (index == 3){
                //ther
                imgStr = @"all_personal_other";
                infoStr = [NSString stringWithFormat:@"%@",model.other];
            }
        }
        
        
        self.HOTCHATinfoLb.text = infoStr;
        self.HOTCHATimgView.image = [UIImage imageNamed:imgStr];
    }
    
    
}
//lzzy
- (UIImageView *)HOTCHATimgView{
    
    if (_HOTCHATimgView == nil) {
        
        _HOTCHATimgView = [[UIImageView alloc]init];
        
    }
    return _HOTCHATimgView;
}
- (UILabel *)HOTCHATinfoLb{
    
    if (_HOTCHATinfoLb == nil) {
        
        _HOTCHATinfoLb = [[UILabel alloc]init];
        _HOTCHATinfoLb.textColor = HOTCHATHexColor(0x444444);
        _HOTCHATinfoLb.font = [UIFont systemFontOfSize:14];
        
        
    }
    return _HOTCHATinfoLb;
}
- (UILabel *)HOTCHATneedVipTip{
    if (_HOTCHATneedVipTip == nil) {
        _HOTCHATneedVipTip = [[UILabel alloc] init];
        _HOTCHATneedVipTip.font = [UIFont systemFontOfSize:12];
        _HOTCHATneedVipTip.textColor = HOTCHATMainColor;
        _HOTCHATneedVipTip.textAlignment = NSTextAlignmentRight;
        _HOTCHATneedVipTip.text = NSLocalizedString(@"StrN038", nil);
    }
    return _HOTCHATneedVipTip;
}
- (UIView *)HOTCHATcoverView{
    if (_HOTCHATcoverView == nil) {
        _HOTCHATcoverView = [[UIView alloc] init];
        _HOTCHATcoverView.backgroundColor = HOTCHATrgba(212, 181, 255, 0.3);
        _HOTCHATcoverView.layer.masksToBounds = YES;
        _HOTCHATcoverView.layer.cornerRadius = 15/2;
    }
    return _HOTCHATcoverView;
}
@end
